package com.jiuyin.dianjing.ui.activity.team;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.jiuyin.dianjing.R;
import com.jiuyin.dianjing.model.TeammateItemModel;
import com.jiuyin.dianjing.ui.activity.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 参赛队友列表
 */
public class TeammateListActivity extends BaseActivity {
    @BindView(R.id.rcv_page)
    RecyclerView mRcvPage;

    private BaseQuickAdapter<TeammateItemModel, BaseViewHolder> mAdapter;

    @Override
    protected int setLayoutId() {
        return R.layout.activity_teammate_list;
    }

    @Override
    protected void initData() {
        mAdapter = new BaseQuickAdapter<TeammateItemModel, BaseViewHolder>(R.layout.item_teammate) {
            @Override
            protected void convert(@NonNull BaseViewHolder holder, TeammateItemModel model) {
                if (null != model) {
                    holder.setText(R.id.tv_comment_title, model.getTitle());
                    ImageView imageView = holder.getView(R.id.img_comment);
                    Glide.with(TeammateListActivity.this).load(model.getImgUrl()).into(imageView);
//                    holder.addOnClickListener(R.id.ll_teammate);
                }
            }
        };
//        mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
//            TeammateItemModel model = mAdapter.getData().get(position);
//        });
        mRcvPage.setAdapter(mAdapter);
    }

    @Override
    protected void initView() {
        setTitle(R.string.match_my_game);
    }

    @OnClick({R.id.iv_back})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            default:
                break;
        }
    }
}
